package com.example.demo.service.impl;

import com.example.demo.annotation.Verify;
import com.example.demo.domain.po.Terminal;
import com.example.demo.domain.vo.FindTmnByNameVo;
import com.example.demo.mapper.TerminalMapper;
import com.example.demo.service.TerminalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BeanPropertyBindingResult;

import javax.validation.Valid;
import java.util.List;
import java.util.Objects;

/**
 * @author xieluoyin
 */
@Service
public class TerminalServiceImpl implements TerminalService {
    private final
    TerminalMapper terminalMapper;


    @Autowired
    public TerminalServiceImpl(TerminalMapper terminalMapper) {
        this.terminalMapper = terminalMapper;
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void add(@Verify Terminal terminal) {
        terminalMapper.insert(terminal);
    }

    @Override
    public List<Terminal> find(FindTmnByNameVo demoVo) {

        return terminalMapper.findByName(demoVo);
    }
}
